function entity(map) {
    var arr = [];
    arr.push('');
    arr.push('{');
    var columns = map.columns;
    for (var i = 0; i < columns.length; i++) {
        var column = columns[i];
        if(column.require === true || column.length !== undefined){
            arr.push('    ' + column.camelName + ': [');

            var sub = [];
            if (column.require === true) {
                sub.push('        {required: true, message: "[' + column.columnComment + ']字段不允许为空"}');
            }
            if (column.length !== undefined) {
                sub.push('        {min: 0, max: 32, message: "[' + column.columnComment + ']最多' + column.length + '字符"}');
            }

            arr.push(sub.join(', \r\n'))
            arr.push('    ],');
        }
    }
    arr.push('}');
    arr.push('');
    return arr.join("\r\n");
}


function main(map) {
    var arr = [];
    arr.push(entity(map));
    return arr.join('');
}

export default main;



